package com.ruoyi.trainingManagement.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.trainingManagement.mapper.TrainingProgramSubjectMapper;
import com.ruoyi.trainingManagement.domain.TrainingProgramSubject;
import com.ruoyi.trainingManagement.service.ITrainingProgramSubjectService;

/**
 * 培养方案关联学科Service业务层处理
 * 
 * @author chenxl
 * @date 2025-08-11
 */
@Service
public class TrainingProgramSubjectServiceImpl implements ITrainingProgramSubjectService 
{
    @Autowired
    private TrainingProgramSubjectMapper trainingProgramSubjectMapper;

    /**
     * 查询培养方案关联学科
     * 
     * @param id 培养方案关联学科主键
     * @return 培养方案关联学科
     */
    @Override
    public TrainingProgramSubject selectTrainingProgramSubjectById(String id)
    {
        return trainingProgramSubjectMapper.selectTrainingProgramSubjectById(id);
    }

    /**
     * 查询培养方案关联学科列表
     * 
     * @param trainingProgramSubject 培养方案关联学科
     * @return 培养方案关联学科
     */
    @Override
    public List<TrainingProgramSubject> selectTrainingProgramSubjectList(TrainingProgramSubject trainingProgramSubject)
    {
        return trainingProgramSubjectMapper.selectTrainingProgramSubjectList(trainingProgramSubject);
    }

    /**
     * 新增培养方案关联学科
     * 
     * @param trainingProgramSubject 培养方案关联学科
     * @return 结果
     */
    @Override
    public int insertTrainingProgramSubject(TrainingProgramSubject trainingProgramSubject)
    {
        return trainingProgramSubjectMapper.insertTrainingProgramSubject(trainingProgramSubject);
    }

    /**
     * 修改培养方案关联学科
     * 
     * @param trainingProgramSubject 培养方案关联学科
     * @return 结果
     */
    @Override
    public int updateTrainingProgramSubject(TrainingProgramSubject trainingProgramSubject)
    {
        return trainingProgramSubjectMapper.updateTrainingProgramSubject(trainingProgramSubject);
    }

    /**
     * 批量删除培养方案关联学科
     * 
     * @param ids 需要删除的培养方案关联学科主键
     * @return 结果
     */
    @Override
    public int deleteTrainingProgramSubjectByIds(String[] ids)
    {
        return trainingProgramSubjectMapper.deleteTrainingProgramSubjectByIds(ids);
    }

    /**
     * 删除培养方案关联学科信息
     * 
     * @param id 培养方案关联学科主键
     * @return 结果
     */
    @Override
    public int deleteTrainingProgramSubjectById(String id)
    {
        return trainingProgramSubjectMapper.deleteTrainingProgramSubjectById(id);
    }

    /*
     * 根据培养方案ID获取对应的学科列表
     */
    @Override
    public List<TrainingProgramSubject> getSubjectsByTrainingProgramId(String trainingProgramId) {
        return trainingProgramSubjectMapper.selectTrainingProgramSubjectByTrainingProgramId(trainingProgramId);
    }
}
